positionable iterator

/avail/Avail/Data Abstractions/Iterators/Positionable Iterators: positionable iterator
Source: /avail/Avail/Data Abstractions/Iterators/Positionable Iterators
Categories: Data Abstractions, Iterators
Supertypes: iterator
A positionable iterator supports explicitly querying and setting the current position. Specific subtypes may support random access, but all subtypes should support setting the current position to a previous position.

Since the position can be read, it covaries with respect to the positionable iterator hierarchy. Similarly, it can be written, so it must behave covariantly. In order for there to be any usable abstraction, we use read_/write_ to create a variable type with the most general allowed read type and the most specific write type, so that all positionable iterators for which the read type and write are the same (ensured by the _positioned by_† constructor) are considered subtypes of this abstract type.